<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>水平居中</title>
    <style>
        .box {
            width: 600px;
            background-color: #dd7722;
        }

        .div1 {
            width: 200px;
            height: 100px;
            margin: 0px auto;
            background-color: #00ff00;
        }

        .div2 {
            height: 100px;
            width: 300px;
            margin: 0px auto;
            background-color: #0000ff;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="div1"></div>
        <div class="div2"></div>
    </div>
</body>
</html>